//
//  C_ListHeaderView.m
//  音悦咖
//
//  Created by Best on 15/7/21.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "C_ListHeaderView.h"

@implementation C_ListHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)dealloc
{
    [_bulletCountLabel release];
    [_pickCountLabel release];
    [_pickImageView release];
    [_bulletImageView release];
    [_model release];
    [_videoNameLabel release];
    [_placelabel release];
    [_titleLabel release];
    [super dealloc];
    
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
}

- (void)create
{
    CGFloat width = self.frame.size.width;
  //  CGFloat height = self.frame.size.height;
    
    self.videoNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, width - 20, 30)];
    [self addSubview:self.videoNameLabel];
    [_videoNameLabel release];
    
    self.pickImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, self.videoNameLabel.frame.size.height + self.videoNameLabel.frame.origin.y + 10, 30, 20)];
    [self addSubview:self.pickImageView];
    [_pickImageView release];
    
    
    self.pickCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.pickImageView.frame.origin.x + self.pickImageView.frame.size.width + 10, self.pickImageView.frame.origin.y, 40, self.pickImageView.frame.size.height)];
    [self addSubview:self.pickCountLabel];
    self.pickCountLabel.textColor = RGBA(180, 180, 180, 0.8);
    self.pickCountLabel.font = [UIFont systemFontOfSize:13];
    [_pickCountLabel release];
    
    
    self.bulletImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.pickCountLabel.frame.size.width + self.pickCountLabel.frame.origin.x + 30, self.pickImageView.frame.origin.y, self.pickImageView.frame.size.width, self.pickImageView.frame.size.height)];
    [self addSubview:self.bulletImageView];
    [_bulletImageView release];
    
    
    self.bulletCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.bulletImageView.frame.size.width + self.bulletImageView.frame.origin.x + 10, self.pickImageView.frame.origin.y, self.pickCountLabel.frame.size.width, self.pickImageView.frame.size.height)];
    self.bulletCountLabel.textColor = RGBA(180, 180, 180, 0.8);
    self.bulletCountLabel.font = [UIFont systemFontOfSize:13];
    [self addSubview:self.bulletCountLabel];
    [_bulletCountLabel release];
    
    self.placelabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.pickImageView.frame.size.height + self.pickImageView.frame.origin.y + 10, width, 1)];
    [self.placelabel.layer setBorderWidth:1];
    [self.placelabel.layer setBorderColor:[[UIColor blackColor] CGColor]];
    [self addSubview:self.placelabel];
    [_placelabel release];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, self.placelabel.frame.size.height + self.placelabel.frame.origin.y + 5, 60, 30)];
    self.titleLabel.text = @"推荐MV";
    [self addSubview:self.titleLabel];
    [_titleLabel release];
    self.bulletImageView.image = [UIImage imageWithContentsOfFile:GETBUNDLE_PATH(@"bullet@2x", @"png")];
    self.pickImageView.image = [UIImage imageWithContentsOfFile:GETBUNDLE_PATH(@"player@2x", @"png")];

    
}

- (void)setModel:(C_MoviesListModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    self.pickCountLabel.text = [model.pickCount description];
    self.bulletCountLabel.text = [model.bulletCount description];
    self.videoNameLabel.text = model.videoName;
  
}









@end
